<html>
	<body>
		<?php
			require_once '../../../Helpers/DbHelper.php';
			require_once '../../../Controllers/StudentController.php';
			//
			$c = new StudentController();
			//
			if(isset($_POST['create']))
			{
				$a = array
				(
					'id' => $_POST['id'], 
					'name' => $_POST['name'],
					'section' => $_POST['section'],
					'payment' => $_POST['payment']
				);
				$c->create($a);
				$i = mysql_insert_id();
				header("Location: ../view.php?id=$i");
			}
			else if(isset($_POST['cancel']))
			{
				header("Location: ../../../index.php");
			}
		?>
		<?php
			require_once '../../Partials/Navigation.php';
			renderNavigation('../../../');
		?>
		<br />
		Add Student
		<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post">
			ID: <input type="text" name="id" /> <br />
			Name: <input type="text" name="name" /> <br />
			Section: <input type="text" name="section" /> <br />
			Payment: <input type="text" name="payment" /> <br />
			<input type="submit" name="cancel" value="Cancel" />
			<input type="submit" name="create" value="Create" />
		</form>
	</body>
</html>